/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "manager_plan")
@NamedQueries({
    @NamedQuery(name = "ManagerPlan.findAll", query = "SELECT m FROM ManagerPlan m"),
    @NamedQuery(name = "ManagerPlan.findByMpId", query = "SELECT m FROM ManagerPlan m WHERE m.mpId = :mpId"),
    @NamedQuery(name = "ManagerPlan.findByMpProperty", query = "SELECT m FROM ManagerPlan m WHERE m.mpProperty = :mpProperty"),
    @NamedQuery(name = "ManagerPlan.findByMpDescrip", query = "SELECT m FROM ManagerPlan m WHERE m.mpDescrip = :mpDescrip"),
    @NamedQuery(name = "ManagerPlan.findByMpCreate", query = "SELECT m FROM ManagerPlan m WHERE m.mpCreate = :mpCreate"),
    @NamedQuery(name = "ManagerPlan.findByMpBegin", query = "SELECT m FROM ManagerPlan m WHERE m.mpBegin = :mpBegin"),
    @NamedQuery(name = "ManagerPlan.findByMpName", query = "SELECT m FROM ManagerPlan m WHERE m.mpName = :mpName"),
    @NamedQuery(name = "ManagerPlan.findByMpEnd", query = "SELECT m FROM ManagerPlan m WHERE m.mpEnd = :mpEnd")})
public class ManagerPlan implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "mp_id")
    private Integer mpId;
    @Basic(optional = false)
    @Column(name = "mp_property")
    private int mpProperty;
    @Column(name = "mp_descrip")
    private String mpDescrip;
    @Basic(optional = false)
    @Column(name = "mp_create")
    @Temporal(TemporalType.DATE)
    private Date mpCreate;
    @Column(name = "mp_begin")
    @Temporal(TemporalType.DATE)
    private Date mpBegin;
    @Basic(optional = false)
    @Column(name = "mp_name")
    private String mpName;
    @Column(name = "mp_end")
    @Temporal(TemporalType.DATE)
    private Date mpEnd;
    @JoinColumn(name = "p_id", referencedColumnName = "p_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Project project;
    @JoinColumn(name = "manager_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private User user;
    @JoinColumn(name = "leader_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private User user1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "managerPlan", fetch = FetchType.LAZY)
    private List<LeaderPlan> leaderPlanList;

    public ManagerPlan() {
    }

    public ManagerPlan(Integer mpId) {
        this.mpId = mpId;
    }

    public ManagerPlan(Integer mpId, int mpProperty, Date mpCreate, String mpName) {
        this.mpId = mpId;
        this.mpProperty = mpProperty;
        this.mpCreate = mpCreate;
        this.mpName = mpName;
    }

    public Integer getMpId() {
        return mpId;
    }

    public void setMpId(Integer mpId) {
        this.mpId = mpId;
    }

    public int getMpProperty() {
        return mpProperty;
    }

    public void setMpProperty(int mpProperty) {
        this.mpProperty = mpProperty;
    }

    public String getMpDescrip() {
        return mpDescrip;
    }

    public void setMpDescrip(String mpDescrip) {
        this.mpDescrip = mpDescrip;
    }

    public Date getMpCreate() {
        return mpCreate;
    }

    public void setMpCreate(Date mpCreate) {
        this.mpCreate = mpCreate;
    }

    public Date getMpBegin() {
        return mpBegin;
    }

    public void setMpBegin(Date mpBegin) {
        this.mpBegin = mpBegin;
    }

    public String getMpName() {
        return mpName;
    }

    public void setMpName(String mpName) {
        this.mpName = mpName;
    }

    public Date getMpEnd() {
        return mpEnd;
    }

    public void setMpEnd(Date mpEnd) {
        this.mpEnd = mpEnd;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public User getUser1() {
        return user1;
    }

    public void setUser1(User user1) {
        this.user1 = user1;
    }

    public List<LeaderPlan> getLeaderPlanList() {
        return leaderPlanList;
    }

    public void setLeaderPlanList(List<LeaderPlan> leaderPlanList) {
        this.leaderPlanList = leaderPlanList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (mpId != null ? mpId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ManagerPlan)) {
            return false;
        }
        ManagerPlan other = (ManagerPlan) object;
        if ((this.mpId == null && other.mpId != null) || (this.mpId != null && !this.mpId.equals(other.mpId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.ManagerPlan[mpId=" + mpId + "]";
    }

}
